package org.gao.test.transaction.web.sample;

import java.lang.reflect.Proxy;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.gao.test.transaction.web.sample.service.CustomerService;
import org.gao.test.transaction.web.sample.service.CustomerServiceImpl;

public class Action {

	private CustomerService service = (CustomerService) getService(new CustomerServiceImpl());
	
	private Object getService(Object serviceImpl) {
		return Proxy.newProxyInstance(serviceImpl.getClass().getClassLoader(), 
				serviceImpl.getClass().getInterfaces(), 
				new TransactionInvocationHandler(serviceImpl));
	}
	
	public void insert(HttpServletRequest req, HttpServletResponse resp) {
		
		
		//service.insert();
		service.combine();
		
	}
	
}
